import 'package:flutter_project/config/env_config.dart';

class Env {
  // 当前环境
  // 运行： flutter run --dart-define=APP_ENV=dev
  static const _appEnv =
      String.fromEnvironment("APP_ENV", defaultValue: 'test');

  // 当前环境配置
  static EnvConfig get envConfig => _getEnvConfig();
  static EnvConfig _getEnvConfig() {
    switch (_appEnv) {
      case "dev":
        return _devConfig;
      case "test":
        return _testConfig;
      case "uat":
        return _uatConfig;
      case "prod":
        return _proConfig;
      case "release":
        return _releaseConfig;
      default:
        return _testConfig;
    }
  }

  // 开发环境
  static final EnvConfig _devConfig = EnvConfig(
      envName: "dev",
      envHttpUrl: "https://devxxxx:/api/v1",
      envTcpIp: "192.168.1.68",
      envTcpPort: 28799);

  // 测试环境
  static final EnvConfig _testConfig = EnvConfig(
      envName: "test",
      envHttpUrl: "https://testxxxx:/api/v1",
      envTcpIp: "192.168.1.75",
      envTcpPort: 1573);

  // 生产环境
  static final EnvConfig _uatConfig = EnvConfig(
      envName: "uat",
      envHttpUrl: "https://uatxxxx:/api/v1",
      envTcpIp: "192.168.1.75",
      envTcpPort: 1573);

  // prod环境
  static final EnvConfig _proConfig = EnvConfig(
      envName: "prod",
      envHttpUrl: "https://prodxxxx:/api/v1",
      envTcpIp: "192.168.1.75",
      envTcpPort: 1573);
  // release环境
  static final EnvConfig _releaseConfig = EnvConfig(
      envName: "release",
      envHttpUrl: "https://releasexxxx:/api/v1",
      envTcpIp: "192.168.1.75",
      envTcpPort: 1573);
}
